﻿using System;
using System.ComponentModel;
using System.Resources;

using Microsoft.WowAddonStudio.Project.Import;

namespace Microsoft.WowAddonStudio.Project.Import
{
	/// <summary>
	/// Represents the last page of the import wizard.
	/// </summary>
	public partial class FinishWizardPane : InnerPane
	{
		#region Lifecycle methods

		/// <summary>
		/// Creates items of <see cref="FinishWizardPane"/>.
		/// </summary>
		public FinishWizardPane()
		{
			InitializeComponent();
			SetActive += FinishWizardPane_SetActive;
		}

		#endregion

		#region Public member functions

		/// <summary>
		/// Steps the progress bar to the given percent.
		/// </summary>
		/// <param name="percent">Percent of the process.</param>
		public void ReportProgress(int percent)
		{
			importProgressBar.Value = percent;
		}

		/// <summary>
		/// Sets progress to 0. It is called after an error.
		/// </summary>
		public void ResetProgress()
		{
			importProgressBar.Value = 0;
		}

		#endregion

		#region Member functions

		/// <summary>
		/// Handles the SetActive event of the FinishWizardPane control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param>
		private void FinishWizardPane_SetActive(object sender, CancelEventArgs e)
		{
			SetWizardButtons(WizardButtons.Back | WizardButtons.Finish);
		}

		/// <summary>
		/// Handles the Load event of the FinishWizardPane control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
		private void FinishWizardPane_Load(object sender, EventArgs e)
		{
			var res = new ResourceManager(typeof (ImportWizardResources));
			HeaderText = res.GetString("ReadyGroupBox");
			readyLabel.Text = res.GetString("ReadyLabel");
		}

		#endregion
	}
}